function kcolors = findColorClustersInHSV(colors)

% Convert the colors to HSV 
reshapedColors = reshape(colors, size(colors,1), 1, 3);
hsvim = rgb2hsv(reshapedColors);
hsvim = reshape(hsvim, size(colors,1), 3, 1);

H = hsvim(:,1);
H = H(:);

S = hsvim(:,2);
S = S(:);

V = hsvim(:,3);
V = V(:);

C = [H S V];

figure(4);
hold off;
scatter3(H, S, V, 10, 1 - colors);
hold on;

[k kcolorsHsv] = kmeans(hsvim, 100);


% convert to rgb
reshapedColors = reshape(kcolorsHsv, size(kcolorsHsv,1), 1, 3);
rgbim = hsv2rgb(reshapedColors);
kcolors = reshape(rgbim, size(kcolorsHsv,1), 3, 1);


figure(4);
hold on;
scatter3(kcolorsHsv(:,1), kcolorsHsv(:,2), kcolorsHsv(:,3), 50, 1 - kcolors, 'filled');
scatter3(kcolorsHsv(:,1), kcolorsHsv(:,2), kcolorsHsv(:,3), 50, [0 0 0]);

